// created on 25/03/2006 at 21:34
using System;
using Gtk;
using System.Collections;
using System.IO;

public class ButtonMemory : Button, ButtonInterface
{	
	private Image img=null;

	public String fileNameImg="";
	public bool imgVisible=false;
	public bool isShowed=false;

	public ButtonMemory() : base() {
		this.HeightRequest=32;
		this.WidthRequest=32;
	}
	
	public void SetImage(String fileName) {
	
		// Register the image for this button
		img=new Image();
		img.FromFile=fileName;
		fileNameImg=fileName;
	}
	
	public void ShowImage() {
		if (imgVisible==false && img!=null) {
			imgVisible=true;
			this.Add(img);
			ShowAll();
			isShowed=true;
		}
	}
	
	public void HideImage() {
		if (imgVisible==true) {
			this.Remove(img);
			imgVisible=false;
		}
	}
	
	public bool isImgVisible() { return this.imgVisible; }
	
	public bool isSameImg(ButtonMemory b2) {
		if (fileNameImg.Equals(b2.fileNameImg)) {
			return true;
		} else {
			return false;
		}
	}

	public string getNameButton() {
		string name="";
		if (isShowed) {
			name=fileNameImg;
		}
		return name;
	}
}
